package teach.aistar.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import teach.aistar.model.entity.CarDetail;
import teach.aistar.model.vo.BuyCarsQueryVo;
import teach.aistar.model.vo.ProductQueryVo;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

@Component
public interface BuyCarsMapper {

    @Select("select * from car_detail")
    List<CarDetail> findAll();

    List<CarDetail> findByConditionals(ProductQueryVo productQueryVo);

    @Select("select * from car_detail where id = #{value}")
    CarDetail findId(Integer id);

    @Select("select * from car_detail order by likes desc")
    List<CarDetail> findby();

    @Update("update car_detail set likes=likes+1 where id=#{id}")
    int update(int id);

    @Select("select * from car_detail where c_age = #{value}")
    List<CarDetail> findAge(Integer age);



}
